﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data;
using MySql.Data.MySqlClient;

using Maticsoft.Common;
using Maticsoft.Model;

using Maticsoft.DBUtility;//Please add references
using com.qbengo.utility.nodepicker.entity;
using com.qbengo.utility.nodepicker.DAL;

using System.Globalization;

namespace com.qbengo.utility.nodepicker
{
    public partial class MainForm : Form
    {
        VenueInfoForm form;
        
        public MainForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            form = new VenueInfoForm();
            form.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            form = new VenueInfoForm();
            form.ShowDialog();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            
            string connectionString ="server="+this.textBox1.Text+";User Id="+this.textBox2.Text+";password="+this.textBox3.Text+";Persist Security Info=True;database="+textBox4.Text;
            Console.WriteLine(connectionString);
            DbHelperMySQL.connectionString = connectionString;
            VenueDao venueDao = new VenueDao();

            try
            {
                DataSet ds = venueDao.GetList("");
                form = new VenueInfoForm();
                form.ShowDialog();
            }
            catch (Exception) {
                System.Windows.Forms.MessageBox.Show("Database can not be opened, check your input");
            }
            //System.Windows.Forms.MessageBox.Show(DataTableToList(ds.Tables[0]).Count+"");

        }




    }
}
